<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>Building WinMerge MSI Installer</title>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  <style type="text/css">
  <!--
    body {
      font-family: Verdana,Helvetica,Arial,sans-serif;
      font-size: small;
    }
    code,pre {
      font-family: "Courier New",Courier,monospace;
      font-size: 1em;
    }
    h3 {
      padding: 2px;
      border-left: 4px solid #FFCC00;
      border-bottom: 1px solid #FFCC00;
    }
    pre {
      margin-left: 25px;
      margin-right: 25px;
      padding: 5px;
      background-color: #EEEEEE;
      border-left: 10px solid #CCCCCC;
    }
    p.note {
      padding: 5px;
      background-color: #DDDDFF;
      border: 1px solid #6666FF;
    }
  -->
  </style>
</head>
<body>

<h2>Building WinMerge MSI Installer</h2>

<p class="note">MSI installer is still in heavy development and is highly
experimental. DO NOT use it to install WinMerge to production environment!
</p>

<h3>Needed programs:</h3>
<ul>
  <li>
    <a href="http://wix.sourceforge.net/">WiX</a> version 3.5.
  </li>
  <li>
    <a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx">MSBuild</a>.
     MSBuild is part of .NET 2.0 or later SDK.
  </li>
</ul>

<h3>Installer script:</h3>
<p>The main installer script is in <code>Installer/WIX</code> folder:
<code>WinMerge.wxs</code>. This file includes other needed files.</p>

<h3>Folder structure and files needed:</h3>
<p>First make sure you have all needed files compiled and available:</p>
<ul>
  <li>WinMerge executables: <code>WinMergeU.exe</code></li>
  <li>Translation library: <code>MergeLang.dll</code></li>
  <li>Executable translations: <code>/Translations/WinMerge/*.po</code></li>
  <li>Libraries: <code>libexpat.dll</code> and <code>pcre.dll</code></li>
  <li>Manual: <code>WinMerge.chm</code></li>
  <li>ShellExtension: <code>ShellExtensionU.dll</code> and <code>ShellExtensionX64.dll</code></li>
  <li>Documents: <code>/Docs/Users/*</code></li>
  <li>Filters: <code>/Filters/*</code></li>
</ul>

<p>These files are produced by compiling WinMerge, documentation etc, but
that's not subject of this document, refer to <a href="Compiling.html">Compiling.html</a>,
<a href="readme-manual.html">readme-manual.html</a> and
<a href="Translations.html">Translations.html</a>.</p>

<p>In addition you will need Microsoft C- and MFC-runtime <em>merge modules</em>.
Those files are not distributes with WinMerge. By default we use VS2008
merge modules from the <code>%CommonProgramFiles%\Merge Modules</code> folder:</p>
<ul>
  <li><code>Microsoft_VC90_CRT_x86.msm</code></li>
  <li><code>Microsoft_VC90_MFC_x86.msm</code></li>
  <li><code>Microsoft_VC90_CRT_x86_x64.msm</code></li>
  <li><code>Microsoft_VC90_MFC_x86_x64.msm</code></li>
</ul>

<h4>Folder structure</h4>

<p>Copy or move the files into the following layout:</p>

<ul>
 <li>
  <code>Build/</code>
  <ul>
    <li>
     <code>expat</code>
     <ul>
      <li><code>libexpat.dll</code></li>
     </ul>
    </li>
    <li>
     <code>Manual/htmlhelp</code>
     <ul>
      <li><code>WinMerge.chm</code></li>
     </ul>
    </li>
   <li>
    <code>MergeUnicodeRelease/</code>
    <ul>
     <li><code>MergeLang.dll</code></li>
     <li><code>ShellExtensionU.dll</code></li>
     <li><code>WinMergeU.exe</code></li>
    </ul>
   </li>
   <li>
    <code>pcre/</code>
    <ul>
      <li><code>pcre.dll</code></li>
    </ul>
   </li>
   <li>
    <code>ShellExtensionX64/</code>
    <ul>
      <li><code>ShellExtensionX64.dll</code></li>
    </ul>
   </li>
  </ul>
 </li>
 <li>
  <code>Docs/</code>
  <ul>
   <li>
    <code>Users</code>
    <ul>
     <li><em>Copy the entire <code>Docs/Users</code> folder to here</em></li>
    </ul>
   </li>
  </ul>
 </li>
 <li>
  <code>Filters/</code>
  <ul>
   <li><code>FileFilter.tmpl</code></li>
   <li><code>*.flt</code></li>
  </ul>
 </li>
 <li>
  <code>Installer/</code>
  <ul>
   <li>
    <code>WIX/</code>
     <ul>
      <li><em>Copy the entire <code>Installer/WIX</code> folder to here</em></li>
     </ul>
   </li>
  </ul>
 </li>
 <li>
   <code>Translations/</code>
   <ul>
    <li>
     <code>Docs</code>
     <ul>
      <li><code>*.*</code></li>
     </ul>
    </li>
    <li>
     <code>WinMerge</code>
     <ul>
      <li><code>*.po</code></li>
     </ul>
    </li>
   </ul>
 </li>
</ul>

<h3>Running WIX tools to create installer</h3>

<p><code>WinMerge.wxs</code> (in <code>WIX</code> folder)
is script used to create WinMerge MSI installer. Other tools and IDEs can
be used also. For example WixEdit or SharpDevelop.</p>

<h4>Building with MSBuild</h4>

<p>Open the Visual Studio command prompt and CD to <code>Installer/WIX</code> -folder. Run
command:
<pre>
 msbuild.exe WinMerge.wixproj
</pre>
There are two commonly used parameters:
<ul>
  <li>Platform: <code>/p:Platform=x86</code> or <code>/p:Platform=x64</code></li>
  <li>Version: <code>/p:ProductVersion=x.x.x</code>. If the version number
    is not given it is read from <code>Config.wxi</code>. But then filename
    does not contain version number.</li>
</ul>
For example:
<pre>
 msbuild.exe WinMerge.wixproj /p:Platform=x86,ProductVersion=1.0.2
</pre>

<p>If the compile succeeds you have <code>WinMerge-[platform]-Setup.msi</code>
files in <code>Build\WiX\Release\</code>folder's subfolders.

<p><strong>Test installer!</strong></p>

</body>
</html>